/*
 ***************************************************************************
 * MediaTeK Inc.
 * 4F, No. 2 Technology	5th	Rd.
 * Science-based Industrial	Park
 * Hsin-chu, Taiwan, R.O.C.
 *
 * (c) Copyright 2002-2012, MTK.
 *
 * All rights reserved.	MediaTeK's source	code is	an unpublished work	and	the
 * use of a	copyright notice does not imply	otherwise. This	source code
 * contains	confidential trade secret material of MediaTeK Tech. Any attemp
 * or participation	in deciphering,	decoding, reverse engineering or in	any
 * way altering	the	source code	is stricitly prohibited, unless	the	prior
 * written consent of MediaTeK, Inc. is obtained.
 ***************************************************************************

	Module Name:
	omci_internal_export.h

	Abstract:

	Revision History:
	Who			When			What
	--------	----------		----------------------------------------------
	Name		Date			Modification logs
	Xi.Wang		2018/9/5	Create
*/

#ifndef _OMCI_INTERNAL_EXPORT_H_
#define _OMCI_INTERNAL_EXPORT_H_

#include "omci_timer.h"
#include "omci_utily.h"
#include "omci_types.h"
#include "omci_external_msg.h"
#include "omci_me_external.h"


/*CTC */
#define OMCI_EMOP_ACL_TABLE_ENTRY_SET_CTRL_FILED    		14
#define OMCI_EMOP_ACL_TABLE_ENTRY_ROW_PART_FILED     	12
#define OMCI_EMOP_ACL_TABLE_ENTRY_SET_CTRL_MASK		0xc000
#define OMCI_EMOP_ACL_TABLE_ENTRY_ROW_PART_MASK		0x3000
#define OMCI_EMOP_ACL_TABLE_ENTRY_ROW_ID_MASK			0x1ff

/*multicast*/
#define OMCI_MOP_ACL_TABLE_ENTRY_SET_CTRL_FILED    		14
#define OMCI_MOP_ACL_TABLE_ENTRY_ROW_PART_FILED     		11
#define OMCI_MOP_ACL_TABLE_ENTRY_SET_CTRL_MASK			0xc000
#define OMCI_MOP_ACL_TABLE_ENTRY_ROW_PART_MASK		0x3800
#define OMCI_MOP_ACL_TABLE_ENTRY_ROW_ID_988_AMD1_MASK		0x3ff

#define TIMER_COUNT_S        (1000)
#define TIMER_COUNT_MIN      (60*TIMER_COUNT_S)

#ifdef GPON_TCONT_MAX_NUM
#undef GPON_TCONT_MAX_NUM
#define GPON_TCONT_MAX_NUM                   32
#else
#define  GPON_TCONT_MAX_NUM                  32
#endif

#define MAX_TCONT_NUM                           (GPON_TCONT_MAX_NUM - 1)
#define NUM_OF_QUEUE_PER_TCONT                  (pSystemCap->usqMode)
#define MAX_NUM_OF_QUEUE_PER_TCONT              8
#define NUM_OF_QUEUE_PER_UIN_PORT               8
#define MAX_GEMPORT_ID_NUM_1G                   4095
#define MAX_GEMPORT_ID_NUM_10G                  65534

#define OMCI_MODE_GPON  OMCI_LINK_MODE_GPON
#define OMCI_MODE_EPON  OMCI_LINK_MODE_EPON
#define OMCI_MODE_XGPON  OMCI_LINK_MODE_XGPON
#define OMCI_MODE_XGSPON OMCI_LINK_MODE_XGSPON
#define OMCI_MODE_NG2_10G_10G  OMCI_LINK_MODE_NGPON2_10G_10G

#define SLOT_BASE_ID                 (0x100)
#define GPON_SLOT_INST_START_ID      (SLOT_BASE_ID + GPON_SLOT)
#define FE_SLOT_INST_START_ID        (SLOT_BASE_ID + BASET10100_SLOT)
#define GE_SLOT_INST_START_ID        (SLOT_BASE_ID + BASET101001000_SLOT)
#define POTS_SLOT_INST_START_ID      (SLOT_BASE_ID + POTS_SLOT)
#define VEIP_SLOT_INST_START_ID      (SLOT_BASE_ID + VEIP_SLOT)
#define WLAN_SLOT_INST_START_ID      (SLOT_BASE_ID + WLAN_SLOT)
#define VIDEO_UNI_SLOT_INST_START_ID (SLOT_BASE_ID + VIDEO_UNI_SLOT)
#define VIDEO_ANI_SLOT_INST_START_ID (SLOT_BASE_ID + VIDEO_ANI_SLOT)
#define ETHER_10G_SLOT_INST_START_ID (SLOT_BASE_ID + ETHER_10G_SLOT)
#define ETHER_2500_SLOT_INST_START_ID (SLOT_BASE_ID + ETHER_2500_SLOT)
#define ANI_G_INST_START_ID          ((GPON_SLOT<<8) + 1)
#define T_CONT_INST_START_ID         (GPON_SLOT<<8)
#define UNI_INST_START_ID            ((BASET101001000_SLOT<<8)+1)
#define VEIP_PORT_INST_START_ID      ((VEIP_SLOT<<8) + 1)
#define VOIP_LINE_STATUS_INST_START_ID      ((POTS_SLOT<<8)+1)
#define PPTP_VIDEO_UNI_INST_START_ID  ((VIDEO_UNI_SLOT<<8) + 1)
#define PPTP_VIDEO_ANI_INST_START_ID  ((VIDEO_ANI_SLOT<<8) + 1)
#define ETHER_10G_UNI_INST_START_ID   ((ETHER_10G_SLOT<<8) + 1)
#define ETHER_2500_UNI_INST_START_ID  ((ETHER_2500_SLOT<<8) + 1)

#define T_CONT_TOTAL_NUM               (pAniCap->totalTcontNum)
#define T_CONT_TS_NUM                  (pOnuCap->totalTSNum)
#define ETH_1G_UNI_TOTAL_NUM              (pSystemCap->geNum + pSystemCap->feNum)
#define POTS_TOTAL_NUM                 (pSystemCap->potsNum)
#define IP_HOST_TOTAL_NUM               (pOnuCap->iphostNum)
#define PPTP_VIDEO_UNI_NUM              (pSystemCap->videoUniNum)
#define PPTP_VIDEO_ANI_NUM              (pSystemCap->videoAniNum)
#define ETH_10G_UNI_TOTAL_NUM			(pSystemCap->eth10GNum)
#define ETH_2500_UNI_TOTAL_NUM			(pSystemCap->eth2500Num)

#define MAX_ETH_PORT_NUM                (ETH_1G_UNI_TOTAL_NUM + ETH_10G_UNI_TOTAL_NUM + ETH_2500_UNI_TOTAL_NUM)
#define MAX_ETH_PORT_NUM_ARRAY          32
#define UP_PRIORITY_QUEUE_TATOL_NUM     (T_CONT_TOTAL_NUM*NUM_OF_QUEUE_PER_TCONT)
#define DW_PRIORITY_QUEUE_TATOL_NUM     (MAX_ETH_PORT_NUM*NUM_OF_QUEUE_PER_UIN_PORT)


#define MAX_STACK_SIZE 131072

#define GET_DATA_FROM_OLT        0
#define GET_DATA_FROM_DBG_QUEUE  1



typedef struct omciSystemCapablity_s
{
	uint8_t onuType;
	uint8_t gponNum;
	uint8_t feNum;
	uint8_t geNum;
	uint8_t eth10GNum;
	uint8_t eth2500Num;
	uint8_t ethType[MAX_ETH_PORT_NUM_ARRAY];
	uint8_t veipNum;
	uint8_t wlanNum;
	uint8_t potsNum;
	char    usqMode;
	uint8_t videoUniNum;
	uint8_t videoAniNum;
	uint32_t eventMonitorMask;
	softimage_t softimage[2];
	uint8_t currentImageState;
	time_status_msg_t timeStatusMsg;
}omciSystemCapablity_t, *omciSystemCapablity_ptr;

typedef struct omciOnuCapablity_s
{
	char		sn[OMCI_SN_LENS] ;	/* onu serial number, the default is CMCC00000001 */
	char		version[OMCI_VERSION_LENS];
	char 	    equipmentId[OMCI_EQUIPMENTID_LENS];
	uint16_t 	vendorProCode;
	uint8_t 	omccVersion;
	uint8_t 	tmOption;
	uint8_t 	onuSurvivalTime;
	uint16_t 	extendedTcLayer;
	uint8_t 	securityCap;
	uint8_t  	totalTSNum;
	uint16_t 	totalPQNum;
	uint16_t	totalGEMPortNum;
	uint32_t	sysUpTime;
	uint16_t	connectivityCap;
	uint16_t	qoSConfFlex;
	onu_link_mode_t    linkMode;
	char    VoIPbyTR069;
	char    VoIPSepEn;
    char    vlanFilterIPHostEn;
	omciAttrDefVal_t omciAttrDefVal;
	omciOnuSlot_t onuSlot;
	uint8_t selfDefVD;
	uint8_t strictPPTPEthUniSlot;
	char vendorID[OMCI_VENDOR_ID_LENS];
	uint8_t iphostMac[OMCI_IPHOST_MAC_LENS];
	uint8_t iphostNum;
	file_transfer_ctrl_t fileTransCtrl;
	pptp_video_ani_t pptpVideoAni;
	auth_security_meth_t authSecurityMeth;
	uint8_t mibDataSyncInitVal;
}omciOnuCapablity_t, *omciOnuCapablity_ptr;

typedef struct omciAniCapablity_s
{
	uint8_t	srIndication;
	uint8_t	piggybackDBA;
	uint16_t 	totalTcontNum;
	uint16_t	gemBlockLength;
	uint16_t	onuResponseTime;
}omciAniCapablity_t, *omciAniCapablity_ptr;

int omci_get_all_attrs_by_instid(omci_me_info_ptr me_info_ptr, char *table_buf, uint16_t max_table_len);
void omciDumpContent(uint8_t *data, uint16_t lenth);
extern int(*omci_add_vendor_me)(void);
extern int omciAddVendorMeToStdMeTable(void); 
extern int IS_SPECIAL_SLOT;
extern omciSystemCapablity_ptr pSystemCap;
extern omciOnuCapablity_ptr	pOnuCap;
extern omciAniCapablity_ptr	pAniCap;


#endif

